package com.wynet.shopsapp.service.impl;


import com.wynet.shopsapp.dao.UserDetailDao;
import com.wynet.shopsapp.dto.UserDetailDto;
import com.wynet.shopsapp.service.intf.UserDetailService;
import com.wynet.shopsapp.vo.R;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


@Service
public class UserDetailServiceImpl implements UserDetailService {
    @Resource
    private UserDetailDao dao;

    @Override
    public R update(UserDetailDto dto) {
        //1.验证
        if(dto!=null){
            //2.修改数据库
            if(dao.updateDetail(dto)>0){
                return R.ok();
            }
        }
        return R.fail("亲，修改个人资料失败！");
    }

    @Override
    public R queryMy(int uid) {
        return R.ok(dao.queryByUid(uid));
    }
}
